<template>
  <section class="english-container app-container center-flex">
    <canvas id="space"></canvas>
    <div class="card-container">
      <pile-card :data.sync="data">
        <div slot-scope="{item}" class="inner">
          <img
            @mousedown.stop
            @touchstart.stop
            v-clipboard:copy="value"
            class="pic"
            :src="item.picture2"
          >
          <h2 class="note">{{ item.content }}</h2>
          <p class="content">{{ item.note }}</p>
        </div>
      </pile-card>
    </div>
  </section>
</template>

<script>
import PileCard from '@/components/PileCard'

import startSky from '@/utils/starSky'

export default {
  name: 'english',
  components: {
    PileCard
  },
  data() {
    return {
      data: [],
      total: 0
    }
  },
  computed: {
    value() {
      return this.data.length ? this.data[this.data.length - 1].content : '请重新复制'
    }
  },
  methods: {
    async fetchData() {
      const data = await this.$http({
        url: '/api/english',
        params: {
          page: 1,
          size: 5
        }
      })
      this.data = data.list.reverse()
      this.total = data.total
    }
  },
  mounted() {
    startSky('space')
    this.fetchData()
  }
}
</script>

<style lang="scss" scoped>
.english-container {
  color: #1da57a;
  position: flex;
  overflow: hidden;
}
#space {
  position: absolute;
  left: 0;
  top: 0;
}
.english-content {
  width: 100%;
  height: 100%;
}
.inner {
  height: 100%;
  width: 100%;
  background: white;
  border-radius: 5px;
  box-shadow: 0px 0px 10px rgba(255, 255, 255, 0.15);
  overflow: hidden;
  box-sizing: border-box;
}

.note {
  position: relative;
  margin-top: 15px;
  font-size: 14px;
  line-height: 1.2;
  padding: 0 10px;
  text-indent: 1em;
}

.content {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
  text-indent: 1em;
  padding: 0 15px;
  color: #999;
}

.pic {
  width: 100%;
  min-height: 20px;
  position: relative;
}
</style>
